import { Navigate } from "react-router-dom";
import { lazy } from "react";
import Home from "../page/home";
import Own from "../page/own";
import OrgDetail from "../page/orgDetail";
import ProductDetail from "../page/productDetail";
import Payment from "../page/payment";
import EditUserInfo from "../page/editUserInfo";
import Order from "../page/order";
import UserCards from "../page/userCards";
import Reserve from "../page/reserve";
import Timetable from "../page/timetable";
import OwnOrders from '../page/ownOrders';

const NotFound = lazy(() => import("../baseUI/notFound"));
const Login = lazy(() => import("../page/login"));

export enum routeItmeType {
  HOME = "home",
  OWN = "own",
  LOGIN = "login",
  ORG_DETAIL = "orgDetail",
  PRODUCT_DETAIL = "productDetail",
  PAYMENT = "payment",
  EDIT_USER_INFO = "editUserInfo",
  ORDER = "order",
  USERCARDS = "userCards",
  RESERVE = "reserve",
  TIMETABLE = "timetable",
  OWN_ORDERS = "ownOrders"
}

const Routers = [
  {
    path: "/",
    element: <Navigate to="/home" />,
    name: "默认",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.LOGIN}`,
    element: <Login />,
    name: "登录",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.HOME}`,
    element: <Home />,
    name: "首页",
    showTabbar: true,
  },
  {
    path: `/${routeItmeType.TIMETABLE}`,
    element: <Timetable />,
    name: "课程表",
    showTabbar: true,
  },
  {
    path: `/${routeItmeType.USERCARDS}`,
    element: <UserCards />,
    name: "用户消费卡",
    showTabbar: true,
  },
  {
    path: `/${routeItmeType.ORG_DETAIL}/:id`,
    element: <OrgDetail />,
    name: "门店详情",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.OWN}`,
    element: <Own />,
    name: "个人信息",
    showTabbar: true,
  },
  {
    path: `/${routeItmeType.PAYMENT}`,
    element: <Payment />,
    name: "提交订单",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.EDIT_USER_INFO}/:id`,
    element: <EditUserInfo />,
    name: "修改用户信息",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.RESERVE}`,
    element: <Reserve />,
    name: "预约课程",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.OWN_ORDERS}`,
    element: <OwnOrders />,
    name: "我的订单",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.PRODUCT_DETAIL}/:id`,
    element: <ProductDetail />,
    name: "商品详情",
    showTabbar: false,
  },
  {
    path: `/${routeItmeType.ORDER}`,
    element: <Order />,
    name: "订单",
    showTabbar: false,
  },
  {
    path: "*",
    element: <NotFound />,
    name: "未找到",
    showTabbar: false,
  },
];

export default Routers;
